package com.cskaoyan.mapper;

import com.cskaoyan.bean.MarketCategory;
import com.cskaoyan.bean.MarketCategoryExample;
import com.cskaoyan.bean.chenfeng.vo.CategoryIndexVo;
import com.cskaoyan.bean.leihao.bo.CategoryDTO;
import com.cskaoyan.bean.leihao.bo.ChildrenDTO;
import com.cskaoyan.bean.chenfeng.vo.CategoryL1Vo;
import com.cskaoyan.bean.chenfeng.vo.CategorySimpleL1Vo;
import com.cskaoyan.bean.leihao.vo.ChannelDTO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface MarketCategoryMapper {
    long countByExample(MarketCategoryExample example);

    int deleteByExample(MarketCategoryExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(MarketCategory record);

    int insertSelective(MarketCategory record);

    List<MarketCategory> selectByExample(MarketCategoryExample example);

    MarketCategory selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") MarketCategory record, @Param("example") MarketCategoryExample example);

    int updateByExample(@Param("record") MarketCategory record, @Param("example") MarketCategoryExample example);

    int updateByPrimaryKeySelective(MarketCategory record);

    int updateByPrimaryKey(MarketCategory record);

    List<CategoryDTO> selectCategoriesIdAndName();

    List<ChildrenDTO> selectIdAndNameByPid(Integer value);

    // 查询所有L1级别的商品类目以及其子类
    List<CategoryL1Vo> selectL1CategoryWithSub();

    // 查询所有L1级别的商品类目
    List<CategorySimpleL1Vo> selectL1Category();

    // 查询该商品类目名在指定父类目下是否存在
    Integer selectCategoryIdByNameAndPid(@Param("name") String name, @Param("pid") Integer pid);

    // 新增商品类目
    Integer insertCategory(@Param("marketCategory") MarketCategory marketCategory);

    // 修改商品类目信息
    int updateMarketCategory(@Param("marketCategory") MarketCategory marketCategory);

    // 删除指定类目信息以及其子类，实则是修改删除状态
    int deleteCategoryWithSub(@Param("id") Integer id);

    //List<ChannelDTO> selectHomeIndex();
    List<ChannelDTO> selectCategoryByPidIsZero();

    List<Integer> selectIdByPid(Integer id);

    List<MarketCategory> selectByPid(Integer id);

    List<MarketCategory> selectCategoryL2();

    Integer selectPidById(Integer id);
    // 获取最大sortOrder
    List<MarketCategory> selectCategoryWithMaxSortOrder(MarketCategory marketCategory);

    /*
    // 获得商品类目信息
    CategoryIndexVo selectCateGoryIndex();
    */

    // 查询L1级别的类目列表
    List<MarketCategory> selectCateGoryL1List();

    // 查询id最小的商品类目
    MarketCategory selectMinIdCategory();

    // 根据pid查询商品类目
    List<MarketCategory> selectByCategoryPid(@Param("pid") Integer pid);

    // 根据类目id查询商品类目
    MarketCategory selectByCategoryId(@Param("id") Integer id);

    List<MarketCategory> selectByCategoryIdList(@Param("categoryIdList") List<Integer> categoryIdList);

}